<?php
declare(strict_types=1);

namespace LowCode\Naive;

use LowCode\Naive;
use LowCode\Support\JsExp;
use LowCode\Traits\Props\HasDescription;
use LowCode\Traits\Props\HasShow;
use LowCode\Traits\Props\HasSize;
use LowCode\Traits\Slots\HasSlotDescription;
use LowCode\Traits\Slots\HasSlotIcon;

/**
 * Spin组件
 * @method static static make(mixed $children = null) Spin组件
 */
class Spin extends Naive
{
    use HasSize, HasShow, HasDescription;

    use HasSlotDescription, HasSlotIcon;

    public function __construct(mixed $children = null)
    {
        parent::__construct();
        $this->children($children);
    }

    /**
     * 设置组件大小尺寸
     * @param string|int|JsExp $size 'small' | 'medium' | 'large' | number
     * @return $this
     */
    public function size(string|int|JsExp $size = 'small' | 'medium' | 'large'): static
    {
        return $this->prop('size',$size);
    }

    /**
     * 自定义的加载图标是否有旋转动画
     * @param bool|JsExp $bool
     * @return $this
     */
    public function rotate(bool|JsExp $bool = true): static
    {
        return $this->prop('rotate', $bool);
    }

    /**
     * 设置组件Spin 的颜色
     * @param string|JsExp $stroke
     * @return $this
     */
    public function stroke(string|JsExp $stroke): static
    {
        return $this->prop('stroke',$stroke);
    }

    /**
     * Spin 边缘的相对宽度，假定 Spin 的外侧半径是 100
     * @param string|int|JsExp $strokeWidth
     * @return $this
     */
    public function strokeWidth(string|int|JsExp $strokeWidth): static
    {
        return $this->prop('strokeWidth',$strokeWidth);
    }
}
